<template>
  <div class="app-container">
    <el-row :gutter="20">
      <!--分组数据-->
      <el-col :span="3" :xs="24">
        <!-- <div v-hasRole="['ROLE_1']" class="head-container" style="margin-bottom: 10px;">
          <treeselect v-model="deptId" :options="deptOptions" :defaultExpandLevel="2" :normalizer="deptNormalizer"
                      placeholder="请选择机构"/>
        </div> -->
        <div class="head-container">
          <el-input
            v-model="name"
            :placeholder="$t('equipment.groupingInput')"
            clearable
            size="small"
            prefix-icon="el-icon-search"
            style="margin-bottom: 10px"
          />
        </div>
        <div class="head-container">
          <el-tree
            ref="tree"
            :data="groupOptions"
            :props="defaultProps"
            node-key="id"
            :expand-on-click-node="false"
            :filter-node-method="filterNode"
            :highlight-current="true"
            default-expand-all
            :show-checkbox="groupStatus"
            @check-change="handleCheckChange"
            @node-click="handleNodeClick"
          >
            <div slot-scope="{ node, data }" class="el-tree-node__label custom-tree-node custom-tree-item">
              <span class="name">{{ data.name }}</span>
              <div class="right-btns" @click.stop>
                <el-tooltip
                  class="item"
                  effect="dark"
                  :content="groupStatus ? '停用分组' : '启用分组'"
                  placement="top"
                >
                  <el-switch
                    v-if="data.id === 0"
                    v-model="groupStatus"
                    active-color="#13ce66"
                    inactive-color="#ccc"
                    :active-value="true"
                    :inactive-value="false"
                    size="mini"
                    @change="handleGroupStatusChange"
                  />
                </el-tooltip>
                <svg-icon icon-class="plus" @click="addGroup(node, data)" />
                <svg-icon icon-class="edit" @click="editGroup(node, data)" />
                <svg-icon v-if="data.parentId > 0" icon-class="delete" @click="deleteGroup(node, data)" />
              </div>
            </div>
          </el-tree>
        </div>
      </el-col>

      <!--设备数据-->
      <el-col :span="21" :xs="24">
        <el-form v-show="showSearch" ref="queryForm" :model="queryParams" :inline="true" label-width="68px">
          <el-form-item :label="$t('equipment.name')" prop="name">
            <el-input
              v-model="queryParams.name"
              :placeholder="$t('equipment.nameInput')"
              clearable
              size="small"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item :label="$t('equipment.style')" prop="type">
            <el-select v-model="queryParams.type" :placeholder="$t('equipment.styleInput')">
              <el-option
                v-for="dict in typeOptions"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item :label="$t('program.status')" prop="status">
            <el-select v-model="queryParams.status" :placeholder="$t('equipment.statusSelect')" clearable size="small">
              <el-option
                v-for="dict in statusOptions"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item :label="$t('elButton.establishTime')">
            <el-date-picker
              v-model="dateRange"
              size="small"
              style="width: 240px"
              value-format="yyyy-MM-dd"
              type="daterange"
              range-separator="-"
              :start-placeholder="$t('elButton.startTime')"
              :end-placeholder="$t('elButton.endTime')"
            />
          </el-form-item>
          <el-form-item>
            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">{{ $t('elButton.search') }}</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('elButton.reset') }}</el-button>
          </el-form-item>
        </el-form>

        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button
              v-hasPerm="['device_add']"
              type="primary"
              icon="el-icon-plus"
              size="mini"
              @click="handleAdd"
            >{{ $t('elButton.add') }}
            </el-button>
          </el-col>
          <!--<el-col :span="1.5">
            <el-button
              type="success"
              icon="el-icon-edit"
              size="mini"
              :disabled="single"
              @click="handleEdit"
              v-hasPerm="['device_edit']"
            >修改
            </el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="danger"
              icon="el-icon-delete"
              size="mini"
              :disabled="multiple"
              @click="handleDel"
              v-hasPerm="['device_del']"
            >{{$t('elButton.delete')}}
            </el-button>
          </el-col>-->
          <el-col :span="1.5">
            <el-button
              v-hasPerm="['device_export']"
              type="warning"
              icon="el-icon-download"
              size="mini"
              @click="handleExport"
            >导出
            </el-button>
          </el-col>
          <el-button-group>
            <!-- <el-button type="primary" size="mini" :disabled="single" v-hasPerm="['device_auth']"
                       icon="el-icon-circle-check" @click="handleAuth">认证
            </el-button> -->
            <el-button
              v-hasPerm="['device_clear']"
              type="danger"
              size="mini"
              icon="el-icon-delete-solid"
              @click="clear"
            >清空节目
            </el-button>
            <el-dropdown>
              <el-button type="primary" icon="el-icon-s-tools" size="mini">
                音量控制<i class="el-icon-arrow-down el-icon--right" />
              </el-button>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item v-hasPerm="['device_mute']" @click.native="volumeMute">音量静音</el-dropdown-item>
                <el-dropdown-item v-hasPerm="['device_set']" @click.native="volumeSet">音量设置</el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
            <el-dropdown>
              <el-button type="warning" icon="el-icon-switch-button" size="mini">
                电源控制<i class="el-icon-arrow-down el-icon--right" />
              </el-button>
              <el-dropdown-menu slot="dropdown">
                <!--<el-dropdown-item @click.native="shutdown">关机</el-dropdown-item>-->
                <el-dropdown-item v-hasPerm="['device_reboot']" @click.native="reboot">设备重启</el-dropdown-item>
                <el-dropdown-item v-hasPerm="['device_timing']" @click.native="timingSwitch">设备定时</el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
            <el-dropdown>
              <el-button type="primary" icon="el-icon-s-unfold" size="mini">
                更多<i class="el-icon-arrow-down el-icon--right" />
              </el-button>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item v-hasPerm="['device_start']" @click.native="playStart">开始播放</el-dropdown-item>
                <el-dropdown-item v-hasPerm="['device_stop']" @click.native="playStop">停止播放</el-dropdown-item>
                <!--<el-dropdown-item @click.native="enableDevice">启用设备</el-dropdown-item>
                <el-dropdown-item @click.native="disableDevice">停用设备</el-dropdown-item>-->
                <el-dropdown-item v-hasPerm="['device_upgrade']" @click.native="appUpgrade">应用升级</el-dropdown-item>
                <el-dropdown-item v-hasPerm="['device_modeSet']" @click.native="modeSet">模式设置</el-dropdown-item>
                <el-dropdown-item v-hasPerm="['device_backlight']" @click.native="backlightSet">背光开关</el-dropdown-item>
                <el-dropdown-item v-hasPerm="['device_brightness']" @click.native="brightnessSet">亮度设置
                </el-dropdown-item>
                <el-dropdown-item v-hasPerm="['device_rotate']" @click.native="rotateSet">旋转设置</el-dropdown-item>
                <el-dropdown-item v-hasPerm="['device_hav']" @click.native="HAVSet">横竖屏设置</el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </el-button-group>
          <div class="top-right-btn">
            <el-tooltip class="item" effect="dark" :content="$t('elButton.refresh')" placement="top">
              <el-button size="mini" circle icon="el-icon-refresh" @click="handleQuery" />
            </el-tooltip>
            <el-tooltip class="item" effect="dark" :content="showSearch ? $t('elButton.hideSearch') : $t('elButton.showSearch')" placement="top">
              <el-button size="mini" circle icon="el-icon-search" @click="showSearch=!showSearch" />
            </el-tooltip>
            <el-tooltip class="item" effect="dark" :content="listType ? '切换为列表样式' : '切换为栅格样式'" placement="top">
              <el-button size="mini" circle @click="listType = listType === 0 ? 1 : 0">
                <img class="list-type" src="@/assets/img/list_type.png" alt="">
              </el-button>
            </el-tooltip>
          </div>
        </el-row>

        <el-table v-if="listType === 0" v-loading="loading" :data="deviceList" @selection-change="handleSelectionChange" @cell-click="handleEdit">
          <el-table-column v-if="groupStatus === false" type="selection" width="55" align="center" />
          <el-table-column :label="$t('equipment.number')" align="center" width="60" prop="id" />
          <el-table-column :label="$t('equipment.identification')" align="center" prop="code" :show-overflow-tooltip="true" />
          <el-table-column :label="$t('equipment.name')" align="center" prop="name" :show-overflow-tooltip="true" />
          <el-table-column :label="$t('equipment.sort')" align="center" prop="groupName" />
          <el-table-column
            :label="$t('equipment.playStyle')"
            align="center"
            prop="playMode"
            :formatter="playModeFormat"
            :show-overflow-tooltip="true"
          />
          <el-table-column :label="$t('equipment.style')" align="center" prop="type" :formatter="typeFormat" />
          <el-table-column :label="$t('equipment.resolving')" align="center" prop="resolution" />
          <el-table-column :label="$t('equipment.ip')" align="center" prop="ipAddress" :show-overflow-tooltip="true" />
          <el-table-column :label="$t('equipment.edition')" align="center" prop="softVersion" />
          <el-table-column label="设备状态" align="center" prop="status" :formatter="statusFormat" />
          <el-table-column :label="$t('equipment.onlineStatus')" align="center" prop="online">
            <template slot-scope="scope">
              <el-tag v-if="scope.row.online === '0'" type="danger">{{ $t('equipment.isUnderline') }}</el-tag>
              <el-tag v-if="scope.row.online === '1'" type="success">{{ $t('equipment.isOnline') }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column :label="$t('elButton.establishTime')" align="center" prop="createTime" width="180">
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.createTime) }}</span>
            </template>
          </el-table-column>
          <el-table-column width="200px" :label="$t('equipment.control')" align="center" class-name="small-padding fixed-width" fixed="right">
            <template slot-scope="scope">
              <!-- <el-button
                v-if="scope.row.status === '0'"
                size="mini"
                type="text"
                icon="el-icon-circle-check"
                v-hasPerm="['device_auth']"
                @click="handleAuth(scope.row)"
              >认证
              </el-button> -->
              <el-button
                v-hasPerm="['device_edit']"
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleEdit(scope.row)"
              >{{ $t('elButton.change') }}
              </el-button>
              <el-button
                v-hasPerm="['device_edit']"
                size="mini"
                type="text"
                icon="el-icon-info"
                @click="handleDetail(scope.row)"
              >详情
              </el-button>
              <el-button
                v-hasPerm="['device_del']"
                size="mini"
                type="text"
                icon="el-icon-delete"
                @click="handleDel(scope.row)"
              >{{ $t('elButton.delete') }}
              </el-button>
            </template>
          </el-table-column>
        </el-table>

        <div v-else class="out-list flex fx-ai-center fx-wrap">
          <div v-for="item in deviceList" :key="item.id" class="item" @click="handleEdit(item)">
            <div class="title">{{ item.name }}</div>
            <img src="" alt="">
            <div class="bottom">导诊节目</div>
          </div>
        </div>

        <pagination
          v-show="total>0"
          :total="total"
          :page.sync="queryParams.current"
          :limit.sync="queryParams.size"
          @pagination="getList"
        />
      </el-col>

      <!-- 详情，属性，操作 -->
      <!-- <el-col :span="4">
        <div class="operation">
          <div class="tip" v-if="!form.name">请选择设备</div>
          <template v-else>
            <div class="img-box">
              <img :src="'/dev' + form.shotImg" alt="">
            </div>
            <el-collapse v-model="collapseActiveName" accordion>
              <el-collapse-item title="属性" name="1">
                <el-form ref="form" :model="form" :rules="rules" label-width="85px" size="mini">
                  <el-form-item :label="$t('equipment.name')" prop="name">
                    <el-input v-model="form.name" :placeholder="$t('equipment.nameInput')"/>
                  </el-form-item>
                  <el-form-item :label="$t('equipment.identification')" prop="code">
                    <el-input v-model="form.code" :disabled="form.id !== undefined ? true : false" :placeholder="$t('equipment.identificationInput')"/>
                  </el-form-item>
                  <el-form-item :label="$t('equipment.company')" prop="deptId">
                    <treeselect
                      v-model="form.deptId"
                      :options="deptOptions"
                      :defaultExpandLevel="2"
                      :normalizer="deptNormalizer"
                      placeholder="请选择机构名称"
                    />
                  </el-form-item>
                  <el-form-item :label="$t('equipment.sort')" prop="groupId">
                    <treeselect
                      v-model="form.groupId"
                      :options="groupOptions.length ? groupOptions[0].children : []"
                      :normalizer="normalizer"
                      :placeholder="$t('equipment.sortInput')"
                    />
                  </el-form-item>
                  <el-form-item :label="$t('equipment.style')" prop="type">
                    <el-select v-model="form.type" :placeholder="$t('equipment.styleInput')">
                      <el-option
                        v-for="dict in typeOptions"
                        :key="dict.value"
                        :label="dict.label"
                        :value="dict.value"
                      ></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="位置" prop="address">
                    <el-input v-model="form.address" placeholder="请输入位置"/>
                  </el-form-item>
                  <el-form-item label="经纬度" prop="latitude">
                    <el-input
                      type="number"
                      placeholder="经度"
                      class="swidth"
                      v-model="form.latitude">
                    </el-input>
                    <el-input
                      type="number"
                      placeholder="纬度"
                      class="swidth"
                      v-model="form.longitude">
                    </el-input>
                  </el-form-item>
                  <el-form-item :label="$t('equipment.resolving')" prop="resolution">
                    <el-input v-model="form.resolution" :disabled="true" placeholder="请输入分辨率"/>
                  </el-form-item>
                  <el-form-item label="系统版本" prop="osVersion">
                    <el-input v-model="form.osVersion" :disabled="true" placeholder="请输入系统版本"/>
                  </el-form-item>
                  <el-form-item label="MAC地址" prop="macAddress">
                    <el-input v-model="form.macAddress" :disabled="form.id !== undefined ? true : false"
                              placeholder="请输入MAC地址"/>
                  </el-form-item>
                  <el-form-item :label="$t('equipment.ip')" prop="address">
                    <el-input v-model="form.ipAddress" :disabled="true" placeholder="请输入IP地址"/>
                  </el-form-item>
                  <el-form-item :label="$t('equipment.remarks')" prop="remarks">
                    <el-input type="textarea" v-model="form.remarks" rows="3" :placeholder="$t('equipment.remarksInput')"/>
                  </el-form-item>
                  <div class="footer ta-center">
                    <el-button type="primary" @click="submitForm">修改</el-button>
                  </div>
                </el-form>
              </el-collapse-item>
              <el-collapse-item title="动作" name="2">
                <div class="list">
                  <div class="item">重启</div>
                  <div class="item">播放</div>
                  <div class="item">暂停</div>
                  <div class="item">截屏</div>
                  <div class="item">静音</div>
                  <div class="item">
                    <div>音量调节</div>
                    <el-slider v-model="sliderVal" input-size="mini"></el-slider>
                  </div>
                  <div class="item">定时开关机</div>
                  <div class="item">
                    <span>启用</span>
                    <el-switch
                      v-model="value1">
                    </el-switch>
                  </div>
                  <div class="item flex fx-ai-center">
                    <span>定时开机：</span>
                    <el-time-picker
                      class="fx-1"
                      v-model="value1"
                      placeholder="请输入开机时间"
                      :editable="false">
                    </el-time-picker>
                  </div>
                  <div class="item flex fx-ai-center">
                    <span>定时关机：</span>
                    <el-time-picker
                      class="fx-1"
                      v-model="value1"
                      placeholder="请输入关机时间"
                      :editable="false">
                    </el-time-picker>
                  </div>
                </div>
              </el-collapse-item>
              <el-collapse-item title="频道" name="3">
                <div class="list">
                  <div class="item flex fx-ai-center">
                    <span class="ta-right" style="width:92px;">默认播放频道：</span>
                    <el-input class="fx-1" placeholder="请输入默认播放频道"></el-input>
                  </div>
                  <div class="item flex fx-ai-center">
                    <span class="ta-right" style="width:92px;">报警按键：</span>
                    <el-input class="fx-1" placeholder="请输入报警按键"></el-input>
                  </div>
                  <div class="item flex fx-ai-center">
                    <span class="ta-right" style="width:92px;">消防警报：</span>
                    <el-input class="fx-1" placeholder="请输入消防警报"></el-input>
                  </div>
                </div>
              </el-collapse-item>
              <el-collapse-item title="播放历史" name="4">
                <div class="list">
                  <div class="item flex fx-ai-center">
                    <span class="ta-right" style="width:92px;">默认播放频道：</span>
                    <el-input class="fx-1" placeholder="请输入默认播放频道"></el-input>
                  </div>
                  <div class="item flex fx-ai-center">
                    <span class="ta-right" style="width:92px;">报警按键：</span>
                    <el-input class="fx-1" placeholder="请输入报警按键"></el-input>
                  </div>
                  <div class="item flex fx-ai-center">
                    <span class="ta-right" style="width:92px;">消防警报：</span>
                    <el-input class="fx-1" placeholder="请输入消防警报"></el-input>
                  </div>
                </div>
              </el-collapse-item>
            </el-collapse>
          </template>
        </div>

      </el-col> -->
    </el-row>

    <!-- 添加或修改设备对话框 -->
    <el-dialog :title="title" :visible.sync="open" :modal-append-to-body="true" :append-to-body="true">
      <el-form ref="form" :model="form" :rules="rules" label-width="85px">
        <el-row>
          <el-col :span="12">
            <el-form-item :label="$t('equipment.name')" prop="name">
              <el-input v-model="form.name" :placeholder="$t('equipment.nameInput')" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="$t('equipment.identification')" prop="code">
              <el-input v-model="form.code" :disabled="form.id !== undefined ? true : false" :placeholder="$t('equipment.identificationInput')" />
            </el-form-item>
          </el-col>
          <el-col v-hasRole="['ROLE_1']" :span="12">
            <el-form-item :label="$t('equipment.company')" prop="deptId">
              <treeselect
                v-model="form.deptId"
                :options="deptOptions"
                :default-expand-level="2"
                :normalizer="deptNormalizer"
                placeholder="请选择机构名称"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="$t('equipment.sort')" prop="groupId">
              <treeselect
                v-model="form.groupId"
                :options="groupOptions.length ? groupOptions[0].children : []"
                :normalizer="normalizer"
                :placeholder="$t('equipment.sortInput')"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="$t('equipment.style')" prop="type">
              <el-select v-model="form.type" :placeholder="$t('equipment.styleInput')">
                <el-option
                  v-for="dict in typeOptions"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="位置" prop="address">
              <el-input v-model="form.address" placeholder="请输入位置" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="经纬度" prop="latitude">
              <el-input
                v-model="form.latitude"
                type="number"
                placeholder="经度"
                class="swidth"
              />
              <el-input
                v-model="form.longitude"
                type="number"
                placeholder="纬度"
                class="swidth"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="$t('equipment.resolving')" prop="resolution">
              <el-input v-model="form.resolution" :disabled="true" placeholder="请输入分辨率" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="系统版本" prop="osVersion">
              <el-input v-model="form.osVersion" :disabled="true" placeholder="请输入系统版本" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="MAC地址" prop="macAddress">
              <el-input
                v-model="form.macAddress"
                :disabled="form.id !== undefined ? true : false"
                placeholder="请输入MAC地址"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="$t('equipment.ip')" prop="address">
              <el-input v-model="form.ipAddress" :disabled="true" placeholder="请输入IP地址" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item :label="$t('equipment.remarks')" prop="remarks">
              <el-input v-model="form.remarks" type="textarea" rows="3" :placeholder="$t('equipment.remarksInput')" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">{{ $t('submitText') }}</el-button>
        <el-button @click="cancel">{{ $t('cancelText') }}</el-button>
      </div>
    </el-dialog>

    <!-- 认证对话框 -->
    <el-dialog title="设备认证" :visible.sync="authOpen" :modal-append-to-body="true" :append-to-body="true">
      <el-form ref="authForm" :model="authForm" :rules="authRules" label-width="85px">
        <el-row>
          <el-col :span="12">
            <el-form-item :label="$t('equipment.name')" prop="name">
              <el-input v-model="authForm.name" :placeholder="$t('equipment.nameInput')" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="$t('equipment.identification')" prop="code">
              <el-input v-model="authForm.code" :disabled="true" :placeholder="$t('equipment.identificationInput')" />
            </el-form-item>
          </el-col>
          <el-col v-hasRole="['ROLE_1']" :span="12">
            <el-form-item :label="$t('equipment.company')" prop="deptId">
              <treeselect
                v-model="authForm.deptId"
                :options="deptOptions"
                :normalizer="deptNormalizer"
                placeholder="请选择机构名称"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="$t('equipment.sort')" prop="groupId">
              <treeselect
                v-model="authForm.groupId"
                :options="groupOptions.length ? groupOptions[0].children : []"
                :normalizer="normalizer"
                :placeholder="$t('equipment.sortInput')"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="$t('equipment.style')" prop="type">
              <el-select v-model="authForm.type" :placeholder="$t('equipment.styleInput')">
                <el-option
                  v-for="dict in typeOptions"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="位置" prop="address">
              <el-input v-model="authForm.address" placeholder="请输入位置" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="经纬度" prop="latitude">
              <el-input
                v-model="authForm.latitude"
                type="number"
                placeholder="经度"
                class="swidth"
              />
              <el-input
                v-model="authForm.longitude"
                type="number"
                placeholder="纬度"
                class="swidth"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="$t('equipment.resolving')" prop="resolution">
              <el-input v-model="authForm.resolution" :disabled="true" placeholder="请输入分辨率" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="系统版本" prop="osVersion">
              <el-input v-model="authForm.osVersion" :disabled="true" placeholder="请输入系统版本" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="MAC地址" prop="address">
              <el-input v-model="authForm.macAddress" :disabled="true" placeholder="请输入MAC地址" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="$t('equipment.ip')" prop="address">
              <el-input v-model="authForm.ipAddress" :disabled="true" placeholder="请输入IP地址" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item :label="$t('equipment.remarks')" prop="remarks">
              <el-input v-model="authForm.remarks" type="textarea" rows="3" :placeholder="$t('equipment.remarksInput')" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button v-if="authForm.status === '0' || authForm.status === '3'" type="primary" @click="authSubmitForm">认证</el-button>
        <el-button @click="authCancel">{{ $t('cancelText') }}</el-button>
      </div>
    </el-dialog>

    <!--审核页面-->
    <audit :obj="auditObj" :visible.sync="auditVisible" audit-title="设备审核" audit-type="device" />

    <!--添加/编辑分组-->
    <el-dialog :visible.sync="groupDialogVisible" title="分 组" width="30%" class="wrapper" :modal-append-to-body="true" :append-to-body="true" @closed="groupDialogClosed">
      <el-form ref="groupForm" :model="groupObj" :rules="groupRules" label-width="80px">
        <el-form-item :label="$t('equipment.sort')" prop="name">
          <el-input
            ref="name"
            v-model="groupObj.name"
            size="small"
            maxlength="30"
            @keyup.enter.native="handleClickSaveGroup"
          />
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="handleClickSaveGroup">{{ $t('submitText') }}</el-button>
        <el-button @click="groupDialogVisible = false">{{ $t('cancelText') }}</el-button>
      </span>
    </el-dialog>

    <!-- 定时开关机对话框 -->
    <el-dialog title="定时开关机" :visible.sync="tOpen" width="680px" :modal-append-to-body="true" :append-to-body="true">
      <el-form label-width="85px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="关机时间" prop="shutTiming">
              <el-time-picker
                v-model="shutTiming"
                format="HH:mm"
                value-format="HH:mm"
                :picker-options="{format: 'HH:mm'}"
                placeholder="关机时间"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="开机时间" prop="startTiming">
              <el-time-picker
                v-model="startTiming"
                format="HH:mm"
                value-format="HH:mm"
                :picker-options="{format: 'HH:mm'}"
                placeholder="开机时间"
              />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" @click="tCancel">{{ $t('cancelText') }}</el-button>
        <el-button size="small" type="primary" @click="tSubmitForm">{{ $t('submitText') }}</el-button>
      </div>
    </el-dialog>

    <!-- 屏幕旋转对话框 -->
    <el-dialog title="屏幕旋转" :visible.sync="rOpen" width="560px" center :modal-append-to-body="true" :append-to-body="true">
      <el-form label-width="85px">
        <el-row>
          <el-col :span="24">
            <el-form-item label="旋转角度" prop="rotationDegree">
              <el-select v-model="rotationDegree" placeholder="请选择旋转角度" clearable>
                <el-option label="0" value="0" />
                <el-option label="90" value="90" />
                <el-option label="180" value="180" />
                <el-option label="270" value="270" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" @click="rCancel">{{ $t('cancelText') }}</el-button>
        <el-button size="small" type="primary" @click="rSubmitForm">{{ $t('submitText') }}</el-button>
      </div>
    </el-dialog>

    <!-- 模式设置对话框 -->
    <el-dialog title="模式设置" :visible.sync="pOpen" width="560px" center :modal-append-to-body="true" :append-to-body="true">
      <el-form label-width="85px">
        <el-row>
          <el-col :span="24">
            <el-form-item label="模式设置为" prop="playMode">
              <el-select v-model="playMode" placeholder="请选择模式" clearable>
                <el-option label="单机SD卡模式" value="0" />
                <el-option label="云平台模式" value="1" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" @click="pCancel">{{ $t('cancelText') }}</el-button>
        <el-button size="small" type="primary" @click="pSubmitForm">{{ $t('submitText') }}</el-button>
      </div>
    </el-dialog>

    <!-- 监控详情对话框 -->
    <el-dialog :title="mTitle" class="dialog" :fullscreen="true" :visible.sync="mOpen" :modal-append-to-body="true" :append-to-body="true">
      <el-row :gutter="10">
        <el-col :span="24" style="margin-bottom: 10px;">
          <el-card class="box-card">
            <div slot="header" class="clearfix">
              <span>详情信息</span>
              <el-button style="float: right; padding: 3px 0" type="text" @click="getDeviceInfo">刷新</el-button>
            </div>
            <div class="el-table el-table--enable-row-hover el-table--medium">
              <table cellspacing="0" style="width: 100%;">
                <tbody>
                  <tr>
                    <td class="title">
                      <div class="cell">设备名称</div>
                    </td>
                    <td>
                      <div class="cell">{{ deviceInfo.name }}</div>
                    </td>
                    <td class="title">
                      <div class="cell">设备标识</div>
                    </td>
                    <td>
                      <div class="cell">{{ deviceInfo.code }}</div>
                    </td>
                    <td class="title">
                      <div class="cell">设备状态</div>
                    </td>
                    <td>
                      <div class="cell">
                        <el-tag type="primary">{{ statusFormat(deviceInfo) }}</el-tag>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td class="title">
                      <div class="cell">所属机构</div>
                    </td>
                    <td>
                      <div class="cell">{{ deviceInfo.deptName }}</div>
                    </td>
                    <td class="title">
                      <div class="cell">IP地址</div>
                    </td>
                    <td>
                      <div class="cell">{{ deviceInfo.ipAddress }}</div>
                    </td>
                    <td class="title">
                      <div class="cell">分辨率</div>
                    </td>
                    <td>
                      <div class="cell">{{ deviceInfo.resolution }}</div>
                    </td>
                  </tr>
                  <tr>
                    <td class="title">
                      <div class="cell">所属分组</div>
                    </td>
                    <td>
                      <div class="cell">{{ deviceInfo.groupName }}</div>
                    </td>
                    <td class="title">
                      <div class="cell">播放模式</div>
                    </td>
                    <td>
                      <div class="cell">{{ playModeFormat(deviceInfo) }}</div>
                    </td>
                    <td class="title">
                      <div class="cell">设备音量</div>
                    </td>
                    <td>
                      <div class="cell">{{ deviceInfo.volume }}</div>
                    </td>
                  </tr>
                  <tr>
                    <td class="title">
                      <div class="cell">设备类型</div>
                    </td>
                    <td>
                      <div class="cell">{{ typeFormat(deviceInfo) }}</div>
                    </td>
                    <td class="title">
                      <div class="cell">设备MAC</div>
                    </td>
                    <td>
                      <div class="cell">{{ deviceInfo.macAddress }}</div>
                    </td>
                    <td class="title">
                      <div class="cell">设备位置</div>
                    </td>
                    <td>
                      <div class="cell">{{ deviceInfo.address }}</div>
                    </td>
                  </tr>
                  <tr>
                    <td class="title">
                      <div class="cell">系统版本</div>
                    </td>
                    <td>
                      <div class="cell">{{ deviceInfo.osVersion }}</div>
                    </td>
                    <td class="title">
                      <div class="cell">软件版本</div>
                    </td>
                    <td>
                      <div class="cell">{{ deviceInfo.softVersion }}</div>
                    </td>
                    <td class="title">
                      <div class="cell">更新时间</div>
                    </td>
                    <td>
                      <div class="cell">{{ deviceInfo.updateTime }}</div>
                    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </el-card>
        </el-col>
        <el-col :span="24" style="margin-bottom: 10px;">
          <el-card class="box-card">
            <div slot="header" class="clearfix">
              <span>设备状态</span>
              <el-button style="float: right; padding: 3px 0" type="text" @click="getDeviceStatus()">刷新</el-button>
            </div>
            <div class="el-table el-table--enable-row-hover el-table--medium">
              <table cellspacing="0" style="width: 100%;">
                <tbody>
                  <tr>
                    <td class="title">
                      <div class="cell">当前播放节目</div>
                    </td>
                    <td>
                      <div class="cell">{{ statusInfo.curProgram }}</div>
                    </td>
                    <td class="title">
                      <div class="cell">设备运行时长</div>
                    </td>
                    <td>
                      <div class="cell">{{ statusInfo.runTime }}分</div>
                    </td>
                    <td class="title">
                      <div class="cell">设备运行内存</div>
                    </td>
                    <td>
                      <div class="cell">
                        {{ statusInfo.availMem }}/{{ statusInfo.totalMem }}
                      </div>
                    </td>
                    <td class="title">
                      <div class="cell">设备存储空间</div>
                    </td>
                    <td>
                      <div class="cell">
                        {{ statusInfo.useStorage }}/{{ statusInfo.totalStorage }}
                      </div>
                    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </el-card>
        </el-col>
        <el-col :span="18">
          <el-card class="box-card">
            <div slot="header" class="clearfix">
              <span>当前排期</span>
              <el-button style="float: right; padding: 3px 0" type="text" @click="getDeviceScheduling">刷新</el-button>
            </div>
            <el-table
              :data="schedulingList"
              style="width: 100%"
              :border="true"
              :stripe="true"
            >
              <el-table-column
                prop="name"
                label="排期名称"
              />
              <el-table-column
                prop="type"
                label="发布类型"
                width="100px"
              >
                <template slot-scope="scope">
                  <el-tag v-if="scope.row.type === '0'" type="info">默认</el-tag>
                  <el-tag v-if="scope.row.type === '1'">轮播</el-tag>
                  <el-tag v-if="scope.row.type === '2'" type="danger">插播</el-tag>
                </template>
              </el-table-column>
              <el-table-column
                prop="playMode"
                :label="$t('equipment.channelMode')"
                width="120px"
              >
                <template slot-scope="scope">
                  <el-tag v-if="scope.row.playMode === '0'" type="info">{{ $t('equipment.channelMode1') }}</el-tag>
                  <el-tag v-if="scope.row.playMode === '1'" type="success">{{ $t('equipment.channelMode2') }}</el-tag>
                </template>
              </el-table-column>
              <el-table-column
                prop="startDate"
                :label="$t('equipment.channelPlayDate')"
              >
                <template slot-scope="scope">
                  <span>{{ `${parseTime(scope.row.startDate, '{y}-{m}-{d}')}` + $t('untils') + `${parseTime(scope.row.stopDate, '{y}-{m}-{d}')}` }}</span>
                </template>
              </el-table-column>
              <el-table-column
                prop="startTime"
                :label="$t('equipment.channelPlayTime')"
              >
                <template slot-scope="scope">
                  <span>{{ `${scope.row.startTime}` + $t('untils') + `${scope.row.stopTime}` }}</span>
                </template>
              </el-table-column>
              <el-table-column
                prop="checkTime"
                label="发布时间"
                width="100px"
              >
                <template slot-scope="scope">
                  <span>{{ parseTime(scope.row.checkTime) }}</span>
                </template>
              </el-table-column>
              <!--<el-table-column
                :label="$t('equipment.control')"
                width="80px">
                <template slot-scope="scope">
                  <el-button type="text" icon="el-icon-delete" @click="handleClickDeleteVersion(scope)">删除</el-button>
                </template>
              </el-table-column>-->
            </el-table>
          </el-card>
        </el-col>
        <el-col :span="6">
          <el-card class="box-card">
            <div slot="header" class="clearfix">
              <span>设备截屏</span>
              <el-button type="text" style="float: right; padding: 3px 0" @click="getDeviceInfo">刷新</el-button>
              <el-button
                v-hasPerm="['device_screenshot']"
                type="text"
                style="float: right; padding: 3px 10px"
                @click="screenshot"
              >截屏
              </el-button>
            </div>
            <el-image
              :src="deviceInfo.shotImg !== '' ? baseApi + deviceInfo.shotImg : defShotImg"
              height="278"
            />
            <div class="shotTime">更新时间：{{ deviceInfo.shotTime }}</div>
          </el-card>
        </el-col>
      </el-row>
      <div slot="footer" class="dialog-footer">
        <el-button @click="mClose">关 闭</el-button>
      </div>
    </el-dialog>

    <el-drawer
      :visible.sync="drawer"
      direction="rtl"
      :append-to-body="false"
      :modal-append-to-body="false"
      size="20%"
      :with-header="false"
    >
      <div class="operation">
        <div v-if="!form.name" class="tip">请选择设备</div>
        <template v-else>
          <div class="img-box">
            <img v-if="form.shotImg" :src="'/dev' + form.shotImg" alt="">
            <span v-else>暂无图片</span>
          </div>
          <el-collapse v-model="collapseActiveName" accordion>
            <el-collapse-item title="属性" name="1">
              <el-form ref="form" :model="form" :rules="rules" label-width="85px" size="mini">
                <el-form-item :label="$t('equipment.name')" prop="name">
                  <el-input v-model="form.name" :placeholder="$t('equipment.nameInput')" />
                </el-form-item>
                <el-form-item :label="$t('equipment.identification')" prop="code">
                  <el-input v-model="form.code" :disabled="form.id !== undefined ? true : false" :placeholder="$t('equipment.identificationInput')" />
                </el-form-item>
                <el-form-item :label="$t('equipment.company')" prop="deptId">
                  <treeselect
                    v-model="form.deptId"
                    :options="deptOptions"
                    :default-expand-level="2"
                    :normalizer="deptNormalizer"
                    placeholder="请选择机构名称"
                  />
                </el-form-item>
                <el-form-item :label="$t('equipment.sort')" prop="groupId">
                  <treeselect
                    v-model="form.groupId"
                    :options="groupOptions.length ? groupOptions[0].children : []"
                    :normalizer="normalizer"
                    :placeholder="$t('equipment.sortInput')"
                  />
                </el-form-item>
                <el-form-item :label="$t('equipment.style')" prop="type">
                  <el-select v-model="form.type" :placeholder="$t('equipment.styleInput')">
                    <el-option
                      v-for="dict in typeOptions"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
                <el-form-item label="位置" prop="address">
                  <el-input v-model="form.address" placeholder="请输入位置" />
                </el-form-item>
                <el-form-item label="经纬度" prop="latitude">
                  <el-input
                    v-model="form.latitude"
                    type="number"
                    placeholder="经度"
                    class="swidth"
                  />
                  <el-input
                    v-model="form.longitude"
                    type="number"
                    placeholder="纬度"
                    class="swidth"
                  />
                </el-form-item>
                <el-form-item :label="$t('equipment.resolving')" prop="resolution">
                  <el-input v-model="form.resolution" :disabled="true" placeholder="请输入分辨率" />
                </el-form-item>
                <el-form-item label="系统版本" prop="osVersion">
                  <el-input v-model="form.osVersion" :disabled="true" placeholder="请输入系统版本" />
                </el-form-item>
                <el-form-item label="MAC地址" prop="macAddress">
                  <el-input
                    v-model="form.macAddress"
                    :disabled="form.id !== undefined ? true : false"
                    placeholder="请输入MAC地址"
                  />
                </el-form-item>
                <el-form-item :label="$t('equipment.ip')" prop="address">
                  <el-input v-model="form.ipAddress" :disabled="true" placeholder="请输入IP地址" />
                </el-form-item>
                <el-form-item :label="$t('equipment.remarks')" prop="remarks">
                  <el-input v-model="form.remarks" type="textarea" rows="3" :placeholder="$t('equipment.remarksInput')" />
                </el-form-item>
                <div class="footer ta-center">
                  <el-button type="primary" @click="submitForm">{{ $t('elButton.change') }}</el-button>
                </div>
              </el-form>
            </el-collapse-item>
            <el-collapse-item title="动作" name="2">
              <div class="list">
                <div class="item">重启</div>
                <div class="item">播放</div>
                <div class="item">暂停</div>
                <div class="item">截屏</div>
                <div class="item">静音</div>
                <div class="item">
                  <div>音量调节</div>
                  <el-slider v-model="sliderVal" input-size="mini" />
                </div>
                <div class="item">定时开关机</div>
                <div class="item">
                  <span>启用</span>
                  <el-switch
                    v-model="value1"
                  />
                </div>
                <div class="item flex fx-ai-center">
                  <span>定时开机：</span>
                  <el-time-picker
                    v-model="value1"
                    class="fx-1"
                    placeholder="请输入开机时间"
                    :editable="false"
                  />
                </div>
                <div class="item flex fx-ai-center">
                  <span>定时关机：</span>
                  <el-time-picker
                    v-model="value1"
                    class="fx-1"
                    placeholder="请输入关机时间"
                    :editable="false"
                  />
                </div>
              </div>
            </el-collapse-item>
            <el-collapse-item title="频道" name="3">
              <div class="list">
                <div class="item flex fx-ai-center">
                  <span class="ta-right" style="width:92px;">默认播放频道：</span>
                  <el-input class="fx-1" placeholder="请输入默认播放频道" />
                </div>
                <div class="item flex fx-ai-center">
                  <span class="ta-right" style="width:92px;">报警按键：</span>
                  <el-input class="fx-1" placeholder="请输入报警按键" />
                </div>
                <div class="item flex fx-ai-center">
                  <span class="ta-right" style="width:92px;">消防警报：</span>
                  <el-input class="fx-1" placeholder="请输入消防警报" />
                </div>
              </div>
            </el-collapse-item>
            <el-collapse-item title="播放历史" name="4">
              <div class="list">
                <div class="item flex fx-ai-center">
                  <span class="ta-right" style="width:92px;">默认播放频道：</span>
                  <el-input class="fx-1" placeholder="请输入默认播放频道" />
                </div>
                <div class="item flex fx-ai-center">
                  <span class="ta-right" style="width:92px;">报警按键：</span>
                  <el-input class="fx-1" placeholder="请输入报警按键" />
                </div>
                <div class="item flex fx-ai-center">
                  <span class="ta-right" style="width:92px;">消防警报：</span>
                  <el-input class="fx-1" placeholder="请输入消防警报" />
                </div>
              </div>
            </el-collapse-item>
          </el-collapse>
        </template>
      </div>
    </el-drawer>
  </div>
</template>

<script>
// 设备管理
import {
  listDevice, getDevice, delDevice, addDevice, editDevice, exportDevice, switchTiming, setMode,
  upgradeApp, setBrightness, setVolume, muteVolume, setRotate, setBacklight, shotImage,
  setHAV, startPlay, stopPlay, rebootDevice, shutdownDevice, clearplay, getStatusInfo
} from '@/api/ips/device'
import { deptTree } from '@/api/system/dept'
import { addGroup, editGroup, delGroup, groupTree } from '@/api/ips/group'
import { listScheduling } from '@/api/ips/scheduling'
import Treeselect from '@riophae/vue-treeselect'
import AuditMixin from '@/mixins/audit/index.js'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { getLabelByValInTree } from '@/utils/obj-util'

export default {
  name: 'Device',
  components: { Treeselect },
  mixins: [AuditMixin],
  data() {
    const nameValidator = (rule, val, callback) => {
      if (val) {
        callback()
      } else {
        callback(new Error(this.$t('equipment.groupingInput')))
      }
    }
    return {
      drawer: false,
      listType: 0,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 总条数
      total: 0,
      // 设备表格数据
      deviceList: [],
      // 弹出层标题
      title: '',
      // 是否显示弹出层
      open: false,
      authOpen: false,
      // 模式设置
      pOpen: false,
      playMode: '1',
      // 屏幕旋转
      rOpen: false,
      rotationDegree: 0,
      // 定时开关机
      tOpen: false,
      startTiming: '08:00',
      shutTiming: '20:00',
      // 监控
      mTitle: this.$t('equipment.monitoring'),
      mOpen: false,
      // 日期范围
      dateRange: [],
      // 设备类型字典
      typeOptions: [], // 状态字典
      statusOptions: [], // 查询参数
      playModeOptions: [], // 播放模式
      name: undefined,
      deptId: undefined,
      deptOptions: [],
      groupOptions: [],
      groupDict: [],
      defaultProps: {
        children: 'children',
        label: 'name'
      },
      queryParams: {
        current: 1,
        size: 10,
        fullPathId: 43,
        deptId: undefined,
        name: undefined,
        groupName: undefined,
        type: undefined,
        status: undefined,
        createTime: undefined
      },
      // 显示搜索条件
      showSearch: true,
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        name: [
          { required: true, message: this.$t('equipment.nameEmpty'), trigger: 'blur' }
        ],
        groupId: [
          { required: true, message: this.$t('equipment.sortEmpty'), trigger: 'blur' }
        ],
        type: [
          { required: true, message: this.$t('equipment.styleEmpty'), trigger: 'blur' }
        ],
        macAddress: [
          { required: true, message: 'MAC地址不能为空', trigger: 'blur' }
        ]
      },
      // 认证表单参数
      authForm: {},
      // 认证表单校验
      authRules: {
        name: [
          { required: true, message: this.$t('equipment.nameEmpty'), trigger: 'blur' }
        ],
        type: [
          { required: true, message: this.$t('equipment.styleEmpty'), trigger: 'blur' }
        ],
        groupId: [
          { required: true, message: this.$t('equipment.sortEmpty'), trigger: 'blur' }
        ]
      },
      //
      groupDialogVisible: false,
      groupObj: {},
      groupRules: {
        name: [{ validator: nameValidator }]
      },
      // 启用/停用分组
      groupStatus: false,
      // 选中的分组ID 批量清空节目、音量控制、电源控制、认证、定时开关机用
      selectedGroupIdList: [],
      schedulingList: [],
      deviceInfo: {},
      statusInfo: {
        curProgram: '无',
        runTime: 0,
        availMem: 0,
        totalMem: 0,
        useStorage: 0,
        totalStorage: 0
      },
      defShotImg: require('../../../assets/images/noshot.png'),
      baseApi: process.env.VUE_APP_BASE_API,
      realtimeInfo: {},
      groupIds: 43,
      collapseActiveName: '1',
      sliderVal: 50,
      value1: false
    }
  },
  watch: {
    // 根据名称筛选分组名称树
    name(val) {
      this.$refs.tree.filter(val)
    },
    deptId(val) {
      console.log(val)
      this.queryParams.current = 1
      this.queryParams.deptId = val
      this.getList()
      this.getGroupTree()
    }
  },
  created() {
    this.getList()
    this.getGroupTree()
    this.getDicts('device_type').then(response => {
      this.typeOptions = response.data
    })
    this.getDicts('auth_status').then(response => {
      this.statusOptions = response.data
    })
    this.getDicts('play_mode').then(response => {
      this.playModeOptions = response.data
    })
  },
  mounted() {
    this.$nextTick(() => {
      this.getDeptTree()
    })
  },
  methods: {
    handleClose(done) {
      this.$confirm('确认关闭？')
        .then(_ => {
          done()
        })
        .catch(_ => {})
    },
    handleClickSaveGroup() {
      this.$refs['groupForm'].validate(valid => {
        if (valid) {
          const fun = this.groupObj.id ? editGroup : addGroup
          fun(this.groupObj)
            .then(_ => {
              this.getGroupTree()
              this.$message({
                message: this.$t('saveSuccess'),
                type: 'success',
                showClose: true
              })
              this.groupDialogVisible = false
            })
            .catch(_ => {
            })
        }
      })
    },
    groupDialogClosed() {
      this.groupObj = { name: undefined }
    },
    // 添加分组
    addGroup(node, data) {
      this.groupObj = {
        name: undefined,
        type: 'device',
        parentId: data.id
      }
      this.groupDialogVisible = true
    },
    // 编辑分组
    editGroup(node, data) {
      this.groupObj = JSON.parse(JSON.stringify(data))
      this.groupDialogVisible = true
    },
    // 删除分组
    deleteGroup(node, data) {
      this.$confirm(this.$t('material.deleteMaterialSort') + data.name + '?', this.$t('tip'), {
        confirmButtonText: this.$t('submitText'),
        cancelButtonText: this.$t('cancelText'),
        type: 'warning'
      }).then(function() {
        return delGroup(data.id)
      }).then(() => {
        this.getGroupTree()
        this.msgSuccess(this.$t('deleteSuccess'))
      }).catch(function() {
      })
    },
    /** 查询设备列表 */
    getList() {
      this.loading = true
      listDevice(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
        this.deviceList = response.data
        this.total = response.total
        this.loading = false
      })
    },
    /** 转换机构数据结构 */
    deptNormalizer(node) {
      if (node.children && !node.children.length) {
        delete node.children
      }
      return {
        id: node.deptId,
        label: node.name,
        children: node.children
      }
    },
    /** 查询机构名称下拉树结构 */
    getDeptTree() {
      deptTree().then(response => {
        if (response.data && response.data.length > 0) {
          this.deptOptions = this.handleTree(response.data, 'deptId', 'parentId', 'children', response.data[0].parentId)
        } else {
          this.deptOption = []
        }
      })
    },
    /** 转换分组数据结构 */
    normalizer(node) {
      if (node.children && !node.children.length) {
        delete node.children
      }
      return {
        id: node.id,
        label: node.name,
        children: node.children
      }
    },
    /** 查询分组名称下拉树结构 */
    getGroupTree() {
      groupTree({ deptId: this.deptId, groupId: 43 }).then(response => {
        this.groupOptions = response.data
        this.groupDict = []
        const findChildren = (arr, list) => {
          for (let i = 0; i < arr.length; i++) {
            if (arr[i].id) {
              list.push(arr[i])
            }
            if (arr[i].children && arr[i].children.length) {
              findChildren(arr[i].children, list)
            }
          }
        }
        findChildren(this.groupOptions, this.groupDict)
      })
    },
    // 筛选节点
    filterNode(value, data) {
      if (!value) return true
      return data.name.indexOf(value) !== -1
    },
    // 节点单击事件
    handleNodeClick(data) {
      this.queryParams.fullPathId = data.id
      this.queryParams.current = 1
      this.getList()
    },
    // 设备类型字典翻译
    typeFormat(row, column) {
      return this.selectDictLabel(this.typeOptions, row.type)
    },
    // 状态字典翻译
    statusFormat(row, column) {
      return this.selectDictLabel(this.statusOptions, row.status)
    },
    // 播放模式字典翻译
    playModeFormat(row, column) {
      return this.selectDictLabel(this.playModeOptions, row.playMode)
    },
    // 取消按钮
    cancel() {
      this.open = false
      this.reset()
    },
    // 取消按钮
    authCancel() {
      this.authOpen = false
    },
    mClose() {
      this.mOpen = false
    },
    rCancel() {
      this.rOpen = false
    },
    pCancel() {
      this.pOpen = false
    },
    tCancel() {
      this.tOpen = false
    },
    // 表单重置
    reset() {
      this.form = {
        id: undefined,
        code: undefined,
        name: undefined,
        groupId: undefined,
        groupName: undefined,
        type: undefined,
        status: undefined
      }
      this.resetForm('form')
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.current = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = []
      this.resetForm('queryForm')
      this.handleQuery()
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset()
      this.open = true
      this.title = this.$t('equipment.addEquipment')
    },
    /** 修改按钮操作 */
    handleEdit(row) {
      this.reset()
      const id = row.id || this.ids
      getDevice(id).then(response => {
        this.form = response.data
        this.drawer = true
        this.collapseActiveName = '1'
        // this.open = true
        this.title = this.$t('equipment.changeEquipment')
      })
    },
    handleDetail(row) {
      const id = row.id || this.ids
      getDevice(id).then(response => {
        this.deviceInfo = response.data
        this.mOpen = true
        this.title = this.title = this.$t('equipment.equipmentDetail')
        // 获取设备状态
        this.getDeviceStatus()
        // 获取排期数据
        this.getDeviceScheduling()
      })
    },
    getDeviceInfo() {
      getDevice(this.deviceInfo.id).then(response => {
        this.deviceInfo = response.data
      })
    },
    getDeviceStatus() {
      getStatusInfo(this.deviceInfo.code).then(response => {
        this.statusInfo = response.data
      })
    },
    getDeviceScheduling() {
      listScheduling({ devices: this.deviceInfo.code, current: 1, size: 10 }).then(response => {
        this.schedulingList = response.data
      })
    },
    /** 提交按钮 */
    submitForm: function() {
      this.$refs['form'].validate(valid => {
        if (valid) {
          /* let getNameById = (deptId, deptOptions) => {
              for (let i = 0; i < deptOptions.length; i++) {
                if (deptOptions[i].id === deptId) {
                  return deptOptions[i].name;
                }
                if (deptOptions[i].children) {
                  return getNameById(deptId, deptOptions[i].children);
                }
              }
              return "";
            };
            this.form.deptName = getNameById(this.form.deptId, this.deptOptions);*/
          this.form.deptName = getLabelByValInTree(this.deptOptions, this.form.deptId, {
            label: 'name',
            value: 'deptId'
          })
          if (this.form.id !== undefined) {
            editDevice(this.form).then(response => {
              if (response.code === 0) {
                this.msgSuccess(this.$t('loginLog.changeSuccess'))
                this.open = false
                this.getList()
              } else {
                this.msgError(response.msg)
              }
            })
          } else {
            addDevice(this.form).then(response => {
              if (response.code === 0) {
                this.msgSuccess(this.$t('addSuccess'))
                this.open = false
                this.getList()
              } else {
                this.msgError(response.msg)
              }
            })
          }
        }
      })
    },
    authSubmitForm: function() {
      this.$refs['authForm'].validate(valid => {
        if (valid) {
          this.authForm.deptName = getLabelByValInTree(this.deptOptions, this.authForm.deptId, {
            label: 'name',
            value: 'deptId'
          })
          this.authForm.groupName = getLabelByValInTree(this.groupDict, this.authForm.groupId, {
            label: 'name',
            value: 'id'
          })
          this.authForm.status = '1'
          editDevice(this.authForm).then(response => {
            if (response.code === 0) {
              this.msgSuccess(this.$t('certificationSuccess'))
              this.authOpen = false
              this.getList()
            } else {
              this.msgError(response.msg)
            }
          })
        }
      })
    },
    /** 删除按钮操作 */
    handleDel(row) {
      const ids = row.id || this.ids
      this.$confirm(this.$t('equipment.deleteEquipment1') + ids + this.$t('equipment.deleteEquipment2'), this.$t('tip'), {
        confirmButtonText: this.$t('submitText'),
        cancelButtonText: this.$t('cancelText'),
        type: 'warning'
      }).then(function() {
        return delDevice(ids)
      }).then(() => {
        this.getList()
        this.msgSuccess(this.$t('deleteSuccess'))
      }).catch(function() {
      })
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams
      this.$confirm('是否确认导出选中设备数据项?', this.$t('tip'), {
        confirmButtonText: this.$t('submitText'),
        cancelButtonText: this.$t('cancelText'),
        type: 'warning'
      }).then(function() {
        return exportDevice(queryParams)
      }).then(response => {
        this.download(response.data)
      }).catch(function() {
      })
    },
    // 共三个参数，依次为： 传递给 data 属性的数组中该节点所对应的对象、
    // 节点本身是否被选中、 节点的子树中是否有被选中的节点
    handleCheckChange(a, b, c) {
      if (a.id !== 0) {
        const index = this.selectedGroupIdList.indexOf(a.id)
        if (index === -1) {
          this.selectedGroupIdList.push(a.id)
        } else {
          this.selectedGroupIdList.splice(index, 1)
        }
      }
    },
    // 分组打开/关闭触发函数
    handleGroupStatusChange(val) {
      if (val === false) {
        // 清空选择
        this.selectedGroupIdList.forEach(it => {
          this.$refs.tree.setChecked(it, false)
        })
        this.selectedGroupIdList = []
        console.log('清空节目')
      }
    },
    // 认证
    handleAuth(row) {
      const id = row.id || this.ids
      getDevice(id).then(response => {
        this.authForm = response.data
        this.authOpen = true
      })
    },
    // 定时开关机
    timingSwitch() {
      this.startTiming = '08:00'
      this.shutTiming = '20:00'
      this.tOpen = true
    },
    tSubmitForm: function() {
      let way = 'device'
      let ids = []
      if (this.groupStatus) {
        way = 'group'
        if (this.selectedGroupIdList.length > 0) {
          ids = this.selectedGroupIdList
        } else {
          this.$message({
            message: this.$t('chooseLeftSort'),
            type: 'info',
            showClose: true
          })
        }
      } else {
        way = 'device'
        ids = this.ids
      }
      if (ids.length === 0) {
        this.$message({
          message: this.$t('chooseEquipment'),
          type: 'warning',
          showClose: true
        })
        return
      }
      switchTiming(way, ids, this.startTiming, this.shutTiming).then(response => {
        this.getList()
        this.msgSuccess(this.$t('operationSuccess'))
        this.tOpen = false
      })
    },
    // 点击清空节目触发函数
    clear() {
      let way = 'device'
      let ids = []
      if (this.groupStatus) {
        way = 'group'
        if (this.selectedGroupIdList.length > 0) {
          ids = this.selectedGroupIdList
        } else {
          this.$message({
            message: this.$t('chooseLeftSort'),
            type: 'info',
            showClose: true
          })
        }
      } else {
        way = 'device'
        ids = this.ids
      }
      if (ids.length === 0) {
        this.$message({
          message: this.$t('chooseEquipment'),
          type: 'warning',
          showClose: true
        })
        return
      }
      this.$confirm('确认要清空选择的设备吗？', this.$t('tip'), {
        confirmButtonText: this.$t('submitText'),
        cancelButtonText: this.$t('cancelText'),
        type: 'warning'
      }).then(function() {
        return clearplay(way, ids)
      }).then(response => {
        this.getList()
        this.msgSuccess(this.$t('operationSuccess'))
      }).catch(function() {
      })
    },
    // 音量设置
    volumeSet() {
      let way = 'device'
      let ids = []
      if (this.groupStatus) {
        way = 'group'
        if (this.selectedGroupIdList.length > 0) {
          ids = this.selectedGroupIdList
        } else {
          this.$message({
            message: this.$t('chooseLeftSort'),
            type: 'info',
            showClose: true
          })
        }
      } else {
        way = 'device'
        ids = this.ids
      }
      if (ids.length === 0) {
        this.$message({
          message: this.$t('chooseEquipment'),
          type: 'warning',
          showClose: true
        })
        return
      }
      this.$prompt('请输入音量（0 ~ 100）', this.$t('tip'), {
        confirmButtonText: this.$t('submitText'),
        cancelButtonText: this.$t('cancelText'),
        inputPattern: /^([1-9]?\d|100)$/,
        inputErrorMessage: '音量格式不正确'
      }).then(({ value }) => {
        setVolume(way, ids, value).then(response => {
          this.getList()
          this.msgSuccess(this.$t('operationSuccess'))
        })
      }).catch(() => {
      })
    },
    // 静音
    volumeMute() {
      let way = 'device'
      let ids = []
      if (this.groupStatus) {
        way = 'group'
        if (this.selectedGroupIdList.length > 0) {
          ids = this.selectedGroupIdList
        } else {
          this.$message({
            message: this.$t('chooseLeftSort'),
            type: 'info',
            showClose: true
          })
        }
      } else {
        way = 'device'
        ids = this.ids
      }
      if (ids.length === 0) {
        this.$message({
          message: this.$t('chooseEquipment'),
          type: 'warning',
          showClose: true
        })
        return
      }
      this.$confirm('确认要将选择的设备静音吗？', this.$t('tip'), {
        confirmButtonText: this.$t('submitText'),
        cancelButtonText: this.$t('cancelText'),
        type: 'warning'
      }).then(function() {
        return muteVolume(way, ids)
      }).then(response => {
        this.getList()
        this.msgSuccess(this.$t('operationSuccess'))
      }).catch(function() {
      })
    },
    // 关机
    shutdown() {
      let way = 'device'
      let ids = []
      if (this.groupStatus) {
        way = 'group'
        if (this.selectedGroupIdList.length > 0) {
          ids = this.selectedGroupIdList
        } else {
          this.$message({
            message: this.$t('chooseLeftSort'),
            type: 'info',
            showClose: true
          })
        }
      } else {
        way = 'device'
        ids = this.ids
      }
      if (ids.length === 0) {
        this.$message({
          message: this.$t('chooseEquipment'),
          type: 'warning',
          showClose: true
        })
        return
      }
      this.$confirm('确认要将选择的设备关机吗？', this.$t('tip'), {
        confirmButtonText: this.$t('submitText'),
        cancelButtonText: this.$t('cancelText'),
        type: 'warning'
      }).then(function() {
        return shutdownDevice(way, ids)
      }).then(response => {
        this.getList()
        this.msgSuccess(this.$t('operationSuccess'))
      }).catch(function() {
      })
    },
    // 重启
    reboot() {
      let way = 'device'
      let ids = []
      if (this.groupStatus) {
        way = 'group'
        if (this.selectedGroupIdList.length > 0) {
          ids = this.selectedGroupIdList
        } else {
          this.$message({
            message: this.$t('chooseLeftSort'),
            type: 'info',
            showClose: true
          })
        }
      } else {
        way = 'device'
        ids = this.ids
      }
      if (ids.length === 0) {
        this.$message({
          message: this.$t('chooseEquipment'),
          type: 'warning',
          showClose: true
        })
        return
      }
      this.$confirm('确认要重启选择的设备吗？', this.$t('tip'), {
        confirmButtonText: this.$t('submitText'),
        cancelButtonText: this.$t('cancelText'),
        type: 'warning'
      }).then(function() {
        return rebootDevice(way, ids)
      }).then(response => {
        this.getList()
        this.msgSuccess(this.$t('operationSuccess'))
      }).catch(function() {
      })
    },
    // 开始播放
    playStart() {
      let way = 'device'
      let ids = []
      if (this.groupStatus) {
        way = 'group'
        if (this.selectedGroupIdList.length > 0) {
          ids = this.selectedGroupIdList
        } else {
          this.$message({
            message: this.$t('chooseLeftSort'),
            type: 'info',
            showClose: true
          })
        }
      } else {
        way = 'device'
        ids = this.ids
      }
      if (ids.length === 0) {
        this.$message({
          message: this.$t('chooseEquipment'),
          type: 'warning',
          showClose: true
        })
        return
      }
      this.$confirm('确认要开始播放选择的设备吗？', this.$t('tip'), {
        confirmButtonText: this.$t('submitText'),
        cancelButtonText: this.$t('cancelText'),
        type: 'warning'
      }).then(function() {
        return startPlay(way, ids)
      }).then(response => {
        this.getList()
        this.msgSuccess(this.$t('operationSuccess'))
      }).catch(function() {
      })
    },
    // 停止播放
    playStop() {
      let way = 'device'
      let ids = []
      if (this.groupStatus) {
        way = 'group'
        if (this.selectedGroupIdList.length > 0) {
          ids = this.selectedGroupIdList
        } else {
          this.$message({
            message: this.$t('chooseLeftSort'),
            type: 'info',
            showClose: true
          })
        }
      } else {
        way = 'device'
        ids = this.ids
      }
      if (ids.length === 0) {
        this.$message({
          message: this.$t('chooseEquipment'),
          type: 'warning',
          showClose: true
        })
        return
      }
      this.$confirm('确认要停止播放选择的设备吗？', this.$t('tip'), {
        confirmButtonText: this.$t('submitText'),
        cancelButtonText: this.$t('cancelText'),
        type: 'warning'
      }).then(function() {
        return stopPlay(way, ids)
      }).then(response => {
        this.getList()
        this.msgSuccess(this.$t('operationSuccess'))
      }).catch(function() {
      })
    },
    // 启用设备
    enableDevice() {
    //   if (this.groupStatus) {

      //   } else {

      //   }
      // },
      // // 停用设备
      // disableDevice() {
      //   if (this.groupStatus) {

      //   } else {

    //   }
    },
    // 截屏
    screenshot() {
      if (!this.deviceInfo.id) {
        this.$message({
          message: this.$t('equipment.noEquipment'),
          type: 'warning',
          showClose: true
        })
        return
      }
      const deviceId = this.deviceInfo.id
      this.$confirm(this.$t('equipment.screenCapture'), this.$t('tip'), {
        confirmButtonText: this.$t('submitText'),
        cancelButtonText: this.$t('cancelText'),
        type: 'warning'
      }).then(function() {
        console.log(deviceId)
        return shotImage(deviceId)
      }).then(() => {
        this.getDeviceInfo()
        this.msgSuccess(this.$t('operationSuccess'))
      }).catch(function() {
      })
    },
    // 应用升级
    appUpgrade() {
      let way = 'device'
      let ids = []
      if (this.groupStatus) {
        way = 'group'
        if (this.selectedGroupIdList.length > 0) {
          ids = this.selectedGroupIdList
        } else {
          this.$message({
            message: this.$t('chooseLeftSort'),
            type: 'info',
            showClose: true
          })
        }
      } else {
        way = 'device'
        ids = this.ids
      }
      if (ids.length === 0) {
        this.$message({
          message: this.$t('chooseEquipment'),
          type: 'warning',
          showClose: true
        })
        return
      }
      this.$confirm('确认要升级选择的设备应用版本吗？', this.$t('tip'), {
        confirmButtonText: this.$t('submitText'),
        cancelButtonText: this.$t('cancelText'),
        type: 'warning'
      }).then(function() {
        return upgradeApp(way, ids)
      }).then(response => {
        this.getList()
        this.msgSuccess(this.$t('operationSuccess'))
      }).catch(function() {
      })
    },
    // 模式设置
    modeSet() {
      this.playMode = null
      this.pOpen = true
    },
    pSubmitForm: function() {
      if (!this.playMode) {
        this.$message({
          type: 'warning',
          message: '请选择模式'
        })
        return
      }
      let way = 'device'
      let ids = []
      if (this.groupStatus) {
        way = 'group'
        if (this.selectedGroupIdList.length > 0) {
          ids = this.selectedGroupIdList
        } else {
          this.$message({
            message: this.$t('chooseLeftSort'),
            type: 'info',
            showClose: true
          })
        }
      } else {
        way = 'device'
        ids = this.ids
      }
      if (ids.length === 0) {
        this.$message({
          message: this.$t('chooseEquipment'),
          type: 'warning',
          showClose: true
        })
        return
      }
      setMode(way, ids, this.playMode).then(response => {
        this.getList()
        this.msgSuccess(this.$t('operationSuccess'))
        this.pOpen = false
      })
    },
    // 背光设置
    backlightSet() {
      let way = 'device'
      let ids = []
      if (this.groupStatus) {
        way = 'group'
        if (this.selectedGroupIdList.length > 0) {
          ids = this.selectedGroupIdList
        } else {
          this.$message({
            message: this.$t('chooseLeftSort'),
            type: 'info',
            showClose: true
          })
        }
      } else {
        way = 'device'
        ids = this.ids
      }
      if (ids.length === 0) {
        this.$message({
          message: this.$t('chooseEquipment'),
          type: 'warning',
          showClose: true
        })
        return
      }
      this.$prompt('背光设置（0-关屏，1-开屏）', this.$t('tip'), {
        confirmButtonText: this.$t('submitText'),
        cancelButtonText: this.$t('cancelText'),
        inputPattern: /^([0-1])$/,
        inputErrorMessage: '请输入0或1'
      }).then(({ value }) => {
        setBacklight(way, ids, value).then(response => {
          this.getList()
          this.msgSuccess(this.$t('operationSuccess'))
        })
      }).catch(() => {
      })
    },
    // 亮度设置
    brightnessSet() {
      let way = 'device'
      let ids = []
      if (this.groupStatus) {
        way = 'group'
        if (this.selectedGroupIdList.length > 0) {
          ids = this.selectedGroupIdList
        } else {
          this.$message({
            message: this.$t('chooseLeftSort'),
            type: 'info',
            showClose: true
          })
        }
      } else {
        way = 'device'
        ids = this.ids
      }
      if (ids.length === 0) {
        this.$message({
          message: this.$t('chooseEquipment'),
          type: 'warning',
          showClose: true
        })
        return
      }
      this.$prompt('请输入亮度（0 ~ 255）', this.$t('tip'), {
        confirmButtonText: this.$t('submitText'),
        cancelButtonText: this.$t('cancelText'),
        inputPattern: /^([0-1]?[0-9]?[0-9]|[2][0-4][0-9]|25[0-5])$/,
        inputErrorMessage: '亮度格式不正确'
      }).then(({ value }) => {
        setBrightness(way, ids, value).then(response => {
          this.getList()
          this.msgSuccess(this.$t('operationSuccess'))
        })
      }).catch(() => {
      })
    },
    rSubmitForm: function() {
      if (!this.rotationDegree) {
        this.$message({
          type: 'warning',
          message: '请选择旋转角度'
        })
        return
      }
      let way = 'device'
      let ids = []
      if (this.groupStatus) {
        way = 'group'
        if (this.selectedGroupIdList.length > 0) {
          ids = this.selectedGroupIdList
        } else {
          this.$message({
            message: this.$t('chooseLeftSort'),
            type: 'info',
            showClose: true
          })
        }
      } else {
        way = 'device'
        ids = this.ids
      }
      if (ids.length === 0) {
        this.$message({
          message: this.$t('chooseEquipment'),
          type: 'warning',
          showClose: true
        })
        return
      }
      setRotate(way, ids, this.rotationDegree).then(response => {
        this.getList()
        this.msgSuccess(this.$t('operationSuccess'))
        this.rOpen = false
      })
    },
    // 旋转设置
    rotateSet() {
      this.rotationDegree = null
      this.rOpen = true
    },
    // 横竖屏设置
    HAVSet() {
      let way = 'device'
      let ids = []
      if (this.groupStatus) {
        way = 'group'
        if (this.selectedGroupIdList.length > 0) {
          ids = this.selectedGroupIdList
        } else {
          this.$message({
            message: this.$t('chooseLeftSort'),
            type: 'info',
            showClose: true
          })
        }
      } else {
        way = 'device'
        ids = this.ids
      }
      if (ids.length === 0) {
        this.$message({
          message: this.$t('chooseEquipment'),
          type: 'warning',
          showClose: true
        })
        return
      }
      this.$prompt('横竖屏设置（0-横屏，1-竖屏）', this.$t('tip'), {
        confirmButtonText: this.$t('submitText'),
        cancelButtonText: this.$t('cancelText'),
        inputPattern: /^([0-1])$/,
        inputErrorMessage: '请输入0或1'
      }).then(({ value }) => {
        setHAV(way, ids, value).then(response => {
          this.getList()
          this.msgSuccess(this.$t('operationSuccess'))
        })
      }).catch(() => {
      })
    }
  }
}
</script>

<style lang="scss" scoped>
  /deep/ .el-collapse-item__header{
    background:#F2F2F2;
    padding:0 10px;
  }
  /deep/ .el-collapse-item__wrap{
    padding:10px;
  }
  /deep/ .el-collapse-item{
    border:1px solid #cccccc;
    border-bottom:0;
    &:last-child{
      border-bottom:1px solid #cccccc;
    }
  }
  /deep/ .el-form-item{
    margin-top:10px;
  }
  .operation{
    background:#eeeeee;
    height:100%;
    overflow-y:auto;
    .img-box{
      text-align: center;
      height:120px;
      line-height:120px;
      padding:10px 0;
      img{
        height:100%;
      }
    }
  }
  .list-type{
    width:12px;
    height:12px;
  }
  .tip{
    text-align:center;
    padding-top:80px;
    font-size:18px;
    color:#999999;
  }

  .out-list{
    width:100%;
    .item{
      position:relative;
      border:1px solid #cccccc;
      padding:3px;
      width:135px;
      margin-right:14px;
      margin-bottom:14px;
      border-radius:4px;
      overflow: hidden;
      cursor:pointer;
      .title{
        padding:0 6px;
        font-size:12px;
        background:white;
      }
      img{
        width:100%;
        height:100px;
      }
      .bottom{
        position:absolute;
        bottom:0;
        left:0;
        width:100%;
        padding:0 6px;
        color:white;
        background:rgba(0,0,0,0.3);
        text-align:center;
        font-size:12px;
      }
    }
  }

  .list{
    .item{
      padding:10px 0;
      border-bottom:1px solid #eeeeee;
      &:last-child{
        border-bottom:0;
      }
    }
  }

  .app-container {
    .el-table {
      border-top: 1px solid #e6ebf5;
    }

    .dialog {
      /deep/ .el-dialog {
        overflow: auto;
        width: 100%;
        margin-top: 0 !important;

        .title {
          background-color: #f8f8f9;
        }

        .shotTime {
          margin-top: 20px;
          line-height: 30px;
          font-size: 16px;
          font-weight: bold;
        }
      }
    }

    .custom-tree-item {
      &:after {
        content: "";
        display: block;
        clear: both;
      }

      &:hover {
        .right-btns {
          opacity: 1;
        }
      }

      font-size: 16px;
      width: 100%;

      .right-btns {
        float: right;
        color: #000;
        opacity: 0;
        transition: .3s all;
        user-select: none;

        .svg-icon {
          margin: 0 2px;

          &:hover {
            color: #999;
          }
        }
      }
    }

    .swidth {
      width: 150px;
    }

    /deep/ .el-form-item--medium .el-form-item__content {
      line-height: 34px;
    }

    /deep/ .el-message-box .el-message-box__header {
      width: 400px;
    }

    /deep/ .vue-treeselect__control {
      height: 33px;
    }

  }
</style>
